package com.kzj.global.re;

import lombok.Data;

@Data
public class Result<T> {
    //0 错误，1正确
    private Integer code;
    private T  data;
    private String msg;
    public static <T> Result success(T data)
    {
        Result<T> result = new Result<>();
        result.setCode(1);
        result.setData(data);
        return  result;
    }
    public static <T> Result success()
    {
        Result<T> result = new Result<>();
        result.setCode(1);
        result.setData(null);
        return  result;
    }
    public static <T> Result error(String msg)
    {
        Result<T> result = new Result<>();
        result.setCode(0);
        result.setMsg(msg);
        return  result;
    }
}
